﻿ using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
using System.Windows.Controls;
namespace WPFExcelReport.Controls
{
    public partial class TBTN
    {
        #region ==KEY===========
        public static readonly DependencyProperty KEYProperty = DependencyProperty.Register("KEY",
            typeof(string), typeof(TBTN),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnKEYChanged));
        public string KEY
        {
            get
            {
                return (string)GetValue(KEYProperty);
            }
            set
            {
                SetValue(KEYProperty, value);
            }
        }
        private static void OnKEYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as TBTN;
            if (src != null)
            {
                src.KEY = (string)e.NewValue; 
            }
        }
        #endregion
        #region ==Header===========

        public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("Header",
            typeof(string), typeof(TBTN),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnHeaderChanged));
        public string Header
        {
            get
            {
                return (string)GetValue(HeaderProperty);
            }
            set
            {
                SetValue(HeaderProperty, value);
                bHeader.Text = value;
            }
        }
        private static void OnHeaderChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as TBTN;
            if (src != null)
            {
                src.Header = (string)e.NewValue;
               
            }
        }
        #endregion
        public TBTN()
        {
            InitializeComponent();  
        }  
    }
}
